import Vue from 'vue'
import VueRouter from 'vue-router'
import Layout from "../components/layout"
import Home from "../components/Home";
import Me from "../components/Me";

Vue.use(VueRouter)

export const routes = [
    //添加映射关系
    {
        //默认首页
        path: '/',
        component: Layout,
        redirect: '/home'
    },
    {
        path: '/home',
        component: Layout,
        redirect:"/home",
        children: [
            {
                path: '/home',
                component:Home
            },
        ]
    },
    {
        path: '/me',
        component: Layout,
        redirect:"/me",
        children: [
            {
                path: '/me',
                component:Me
            },
        ]
    },
]

const router = new VueRouter({
    routes:routes // (缩写) 相当于 routes: routes
})

export default router
